<?php
//Khối tin cat                             
$db_list_news   = new db_query('SELECT new_id,new_title,new_date,new_picture,new_teaser,new_detail,new_tags,new_relate,new_active,new_cat_id
                                FROM news 
                                WHERE new_id = '.$iNews.' AND new_active = 1');
$list_news = mysql_fetch_assoc($db_list_news->result);
unset($db_list_news);
if(is_array($list_news)){
    check_rewrite($iNews,$rNews);
    $arr_tags = split_title($list_news['new_title']);
    //var_dump($arr_tags);
    //$str_query = '';
    $sql = array();
    foreach($arr_tags as $tags) {
        $sql[]  = 'new_title LIKE "'.$tags.'%"';
    }
    $db_relate  = new db_query('SELECT new_id,new_title,new_teaser,new_picture,new_cat_id,new_date,new_cat_id,new_tags
                                FROM news 
                                WHERE new_id != '.$iNews.' AND new_cat_id = '.$list_news['new_cat_id'].' AND '.implode(" OR ", $sql).'  
                                LIMIT 15');   
    $arr_relate = $db_relate->resultArray();
    unset($db_relate);
}else{
    die;
}
?>